// markdown 转为html

import MarkdownIt from 'markdown-it'
import 'highlight.js/scss/default.scss'
import 'highlight.js/styles/rainbow.css'
const hljs = require('highlight.js')

const md = new MarkdownIt({
  highlight: function(str, lang) {
    if (lang && hljs.getLanguage(lang)) {
      try {
        return hljs.highlight(lang, str, true).value
      } catch (__) {}
    }
  }
})
export default {
  md
}
